//----------------------------------------------------------------------------------------------------------------
//			Filename:		Chapter2.h
//			  Author:		Adrian De Barro
//			    Date:		10/08/2015
//----------------------------------------------------------------------------------------------------------------
//			  Status:		Currently Building
//----------------------------------------------------------------------------------------------------------------

#include <exception>
#include <iostream>

using std::exception;

namespace Chapter2
{
	//----------------------------------------------------------------------------------------------------------------
	/**
	  *			  Class: VectorClass
	  */
	//----------------------------------------------------------------------------------------------------------------

	class Vector
	{
	public:
		//----------------------------------------------------------------------------------------------------------------
		/**
		  *				Name:	CONSTRUCTOR
		  *		Return Value:	NO RETURN
		  *		  Parameters:   SIZE OF ARRAY
		  *			  Status:	READY
		  */
		//----------------------------------------------------------------------------------------------------------------
		Vector(int s) :elem{ new double[s] }, sz{ s }
		{}
		//----------------------------------------------------------------------------------------------------------------
		/**
		  *				Name:	OPERATOR []
		  *		Return Value:	MEMORY LOCATION OF REQUESTED ELEMENT
		  *		  Parameters:   ELEMENT INDEX
		  *			  Status:	READY
		  */
		//----------------------------------------------------------------------------------------------------------------
		double& operator[](int i)
		{ 
			if (i > sz)
				throw exception("inputted number out of range");
			return elem[i]; 
		}
		//----------------------------------------------------------------------------------------------------------------
	private:
		//array of elements 
		double* elem;
		//size of array
		int sz;
	};

	//----------------------------------------------------------------------------------------------------------------
	/**
	*			  Enumeration Class: Color
	*/
	//----------------------------------------------------------------------------------------------------------------
	enum class Color{ red, blue, green };
	//----------------------------------------------------------------------------------------------------------------
	/**
	*				Name:	OPERATOR ++
	*		Return Value:	REFERNECE OF NEW COLOR
	*		  Parameters:   CURRENT COLOR
	*			  Status:	READY
	*/
	//----------------------------------------------------------------------------------------------------------------
	Color& operator++(Color& p_currentColor)
	{
		switch (p_currentColor)
		{
		case Color::red:
			return p_currentColor = Color::blue;
		case Color::blue:
			return p_currentColor = Color::green;
		case Color::green:
			return p_currentColor = Color::red;
		default:
			return p_currentColor = Color::red;
		}
	}
	//----------------------------------------------------------------------------------------------------------------
	/**
	*				Name:	TestInput
	*		Return Value:	VOID
	*		  Parameters:   INT
	*			  Status:	READY
	*/
	//----------------------------------------------------------------------------------------------------------------
	void TestInput(int p_input)
	{
		try
		{
			if (p_input < 10)
				throw("Error input cannot be smaller than 10");
		}
		catch (exception e)
		{
			std::cout << e.what() << std::endl;
		}
	}
	//----------------------------------------------------------------------------------------------------------------
}